machine:
  node:
    version: 4

general:
  branches:
    ignore:
      - gh-pages

checkout:
  post:
    - git submodule sync
    - git submodule update --init

dependencies:
  post:
    - wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
    - tar -xzf sc-latest-linux.tar.gz

test:
  override:
    - cd sc-*-linux && ./bin/sc --user $SAUCE_USERNAME --api-key $SAUCE_ACCESS_KEY --readyfile ~/sauce_is_ready:
        background: true

    - while [ ! -e ~/sauce_is_ready ]; do sleep 1; done

    - scripts/prepare-tests
    - karma start karma.sauce.js

  post:
    - killall --wait sc  # wait for Sauce Connect to close the tunnel
